home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1980-01-03 | 3.8 KB | 181 lines |
- G4C
-
- ; A File Reader.
-
- ; You MUST set variable *FILENAME to the name of the file you want
- ; displayed, before you call this gui - otherwise you'll get a requester.
-
-
- WinBig 0 11 0 -13 "Loading..." ; you may want to change the position
- WinType 11110001
- Varpath 'read.pop/read.srch' ; use private vars & 2 other guis vars
-
- ;------> On Loading, we open the gui's window..
- ; and load the file stated in the variable "*FILENAME"
- ; This has been set by an other GUI, since we get called from there.
-
- xOnLoad
- setscreen read.gc $*DEF.SCREEN
- dglv_path = ''
- setgad read.gc 2 hide ; hide the 2nd listview
- guiopen read.gc
- ifexists variable *FILENAME
- andifexists file $*FILENAME
- gosub read.gc filechange
- else
- gosub read.gc getfile
- endif
-
- ;-------> Upon closing, we quit so as not to use-up memory
-
- xOnClose
- guiquit read.gc
-
- ;------> on RMB we open our pop-up command window
-
- xOnRMB
- guiopen Read.pop
-
- ;------> on quitting we also quit our other 2 guis
-
- xonquit
- guiquit read.srch
- guiquit read.pop
-
- ;------> Routine to load & show file
-
- xRoutine filechange ; routine to load & show file
- guiscreen read.gc front
- SetWinTitle read.gc "Loading...."
- lvuse read.gc 1 ; choose our display listview
- LVChange $*FILENAME
- SetWinTitle read.gc '$*FILENAME '
-
- ;------------> the listview. - Use 'L' for scrolling the list up/down
-
- xListview 0 0 0 0 "" dglv_line "" 20 TXT
- GadID 1
- GadFont topaz.font 8 000 ; CHANGE THE FONT HERE!
-
- ;------------> open a requester and get a file
-
- xroutine getfile
- setvar dglv_getfile ""
- ReqFile -1 -1 250 200 "Choose file" LOAD dglv_getfile $dglv_path
- if $dglv_getfile != ""
- *FILENAME = $dglv_getfile
- gosub read.gc filechange
- endif
-
-
- ;######################################################################
- ; commands pop-up gui
-
- NEWFILE read.pop
-
-
- WinBig 0 0 80 75 ""
- WinType 00001000
- winonmouse 30 7
- varpath read.gc ; use our main gui's vars
-
- xOnRMB
- guiclose Read.pop
-
- xOnInactive
- guiclose Read.pop
-
- xOnFail
- ezreq "Error during operation" OK ""
-
- ;---------------> the Buttons
-
- xbutton 0 0 0 15 Open
- guiclose Read.pop
- extract *FILENAME PATH dglv_path
- gosub read.gc getfile
-
- xbutton 0 15 0 15 Edit
- guiclose Read.pop
- ifexists gui cedbar.gc ; This is for CEd (long story..)
- guiscreen cedbar.gc front
- sendrexx rexx_ced 'open new'
- sendrexx rexx_ced 'open $*FILENAME'
- sendrexx rexx_ced 'expand view'
- elseifexists variable *DEF.EDITOR
- run '$*DEF.EDITOR $*FILENAME' ; if called from a file manager
- else
- run 'c:ed $*FILENAME' ; use ed if nothing defined
- endif
-
-
- xbutton 0 30 0 15 Search
- guiclose read.pop
- guiopen read.srch
-
-
- xbutton 0 45 0 15 'Delete'
- action delete $*FILENAME req
-
- xbutton 0 60 0 15 Quit
- guiclose read.pop
- guiquit read.gc
-
-
- ;######################################################################
- ; search for string gui
-
- NEWFILE read.srch
-
- winbig -1 -1 300 32 'Enter Search string :'
- wintype 11110001
- varpath ''
-
- xonopen ; reset variables on opening
- mode = CI
- flag = 0
-
-
- xTextIn 0 0 0 15 '' str '' 128
- gosub read.srch search
-
-
- xCycler 0 17 150 14 '' mode ; choose case sensitive/insen..
- cstr 'Ignore case' CI
- cstr 'Same case' CS
-
-
- xButton 150 17 100 14 'Top' ; go to top of lv
- flag = 0
- lvgo #0
- update read.gc 1 0
- setwintitle read.srch 'Enter search string :'
-
-
- xButton 250 17 50 14 >>
- gosub read.srch search
-
-
- xroutine search
- if $str = '' ; no string entered
- stop
- endif
- lvuse read.gc 1 ; use the reader's listview
- if $flag = 0 ; flag=0 means this is the first time
- flag = 1
- lvsearch $str $mode first ; Keywords such as mode (CI or CS), do
- ; not get translated, but in lvsearch
- ; it's an exception, so we can say $mode
- else
- lvsearch $str $mode next
- endif
- if $$lv.line > '' ; update to line found
- update read.gc 1 $$lv.line
- setwintitle read.srch 'Line $$lv.line'
- else
- lvgo #0 ; or else go top again
- flag = 0
- setwintitle read.srch 'Search Finished'
- endif
-
-